#include "Map.h"

#include <string.h>
#include <fan-llvm/core/Core.h>
#include "Type.h"
#include "UnsupportedErr.h"


Type* Map_classType = NULL;
VTable* Map_classVTable = NULL;


/**********************************************
 *
 * Methods and fields
 *
 **********************************************/


/* Void make(Type type) */
void Map_make(Map* self, Type* type)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.make not implemented yet"));
}


/* Bool equals(Obj? that) */
Bool Map_equals(Obj self, NullableObj that)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.equals not implemented yet"));
}


/* Int hash() */
Int Map_hash(Obj self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.hash not implemented yet"));
}


/* Str toStr() */
Str* Map_toStr(Obj self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.toStr not implemented yet"));
}


/* Bool caseInsensitive */
Bool Map_caseInsensitive(Map* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.caseInsensitive not implemented yet"));
}


/* Bool caseInsensitive */
void Map_setCaseInsensitive(Map* self, Bool val)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.caseInsensitive not implemented yet"));
}


/* Bool ordered */
Bool Map_ordered(Map* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.ordered not implemented yet"));
}


/* Bool ordered */
void Map_setOrdered(Map* self, Bool val)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.ordered not implemented yet"));
}


/* V? def */
Val Map_def(Map* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.def not implemented yet"));
}


/* V? def */
void Map_setDef(Map* self, Val val)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.def not implemented yet"));
}


/* Bool isEmpty() */
Bool Map_isEmpty(Map* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.isEmpty not implemented yet"));
}


/* Int size() */
Int Map_size(Map* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.size not implemented yet"));
}


/* V? get(K key, V? def) */
Val Map_get_1(Map* self, Val key)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.get not implemented yet"));
}


/* V? get(K key, V? def) */
Val Map_get(Map* self, Val key, Val def)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.get not implemented yet"));
}


/* Bool containsKey(K key) */
Bool Map_containsKey(Map* self, Val key)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.containsKey not implemented yet"));
}


/* K[] keys() */
List* Map_keys(Map* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.keys not implemented yet"));
}


/* V[] vals() */
List* Map_vals(Map* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.vals not implemented yet"));
}


/* M dup() */
Map* Map_dup(Map* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.dup not implemented yet"));
}


/* M set(K key, V val) */
Map* Map_set(Map* self, Val key, Val val)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.set not implemented yet"));
}


/* M add(K key, V val) */
Map* Map_add(Map* self, Val key, Val val)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.add not implemented yet"));
}


/* V getOrAdd(K key, |K->V| valFunc) */
Val Map_getOrAdd(Map* self, Val key, Func* valFunc)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.getOrAdd not implemented yet"));
}


/* M setAll(M m) */
Map* Map_setAll(Map* self, Map* m)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.setAll not implemented yet"));
}


/* M addAll(M m) */
Map* Map_addAll(Map* self, Map* m)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.addAll not implemented yet"));
}


/* M setList(V[] list, |V,Int->K|? c) */
Map* Map_setList_1(Map* self, List* list)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.setList not implemented yet"));
}


/* M setList(V[] list, |V,Int->K|? c) */
Map* Map_setList(Map* self, List* list, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.setList not implemented yet"));
}


/* M addList(V[] list, |V,Int->K|? c) */
Map* Map_addList_1(Map* self, List* list)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.addList not implemented yet"));
}


/* M addList(V[] list, |V,Int->K|? c) */
Map* Map_addList(Map* self, List* list, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.addList not implemented yet"));
}


/* V? remove(K key) */
Val Map_remove(Map* self, Val key)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.remove not implemented yet"));
}


/* M clear() */
Map* Map_clear(Map* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.clear not implemented yet"));
}


/* Str join(Str separator, |V,K->Str|? c) */
Str* Map_join_1(Map* self, Str* separator)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.join not implemented yet"));
}


/* Str join(Str separator, |V,K->Str|? c) */
Str* Map_join(Map* self, Str* separator, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.join not implemented yet"));
}


/* Str toCode() */
Str* Map_toCode(Map* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.toCode not implemented yet"));
}


/* Void each(|V,K->Void| c) */
void Map_each(Map* self, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.each not implemented yet"));
}


/* Obj? eachWhile(|V,K->Obj?| c) */
NullableObj Map_eachWhile(Map* self, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.eachWhile not implemented yet"));
}


/* V? find(|V,K->Bool| c) */
Val Map_find(Map* self, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.find not implemented yet"));
}


/* M findAll(|V,K->Bool| c) */
Map* Map_findAll(Map* self, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.findAll not implemented yet"));
}


/* M exclude(|V,K->Bool| c) */
Map* Map_exclude(Map* self, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.exclude not implemented yet"));
}


/* Bool any(|V,K->Bool| c) */
Bool Map_any(Map* self, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.any not implemented yet"));
}


/* Bool all(|V,K->Bool| c) */
Bool Map_all(Map* self, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.all not implemented yet"));
}


/* Obj? reduce(Obj? init, |Obj?,V,K->Obj?| c) */
NullableObj Map_reduce(Map* self, NullableObj init, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.reduce not implemented yet"));
}


/* [Obj:Obj?] map(|V,K->Obj?| c) */
Map* Map_map(Map* self, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.map not implemented yet"));
}


/* Bool isRO() */
Bool Map_isRO(Map* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.isRO not implemented yet"));
}


/* Bool isRW() */
Bool Map_isRW(Map* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.isRW not implemented yet"));
}


/* M ro() */
Map* Map_ro(Map* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.ro not implemented yet"));
}


/* M rw() */
Map* Map_rw(Map* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::Map.rw not implemented yet"));
}


/**********************************************
 *
 * Type-system functions
 *
 **********************************************/


Type* Map_initType(void)
{
  if (Map_classType == NULL)
  {
    Type* baseType = Obj_initType();
    VTable* vtable = Map_initVTable();
    Type* type = Type_new("Map", baseType, vtable, sizeof(Map), sizeof(MapVTable));
    Type_registerCtorImplementation(type, "make", Map_make, 1);
    Type_registerMethodImplementation(type, "add", Map_add, 2);
    Type_registerMethodImplementation(type, "addAll", Map_addAll, 1);
    Type_registerMethodImplementation(type, "addList", Map_addList_1, 1);
    Type_registerMethodImplementation(type, "addList", Map_addList, 2);
    Type_registerMethodImplementation(type, "all", Map_all, 1);
    Type_registerMethodImplementation(type, "any", Map_any, 1);
    Type_registerMethodImplementation(type, "clear", Map_clear, 0);
    Type_registerMethodImplementation(type, "containsKey", Map_containsKey, 1);
    Type_registerMethodImplementation(type, "dup", Map_dup, 0);
    Type_registerMethodImplementation(type, "each", Map_each, 1);
    Type_registerMethodImplementation(type, "eachWhile", Map_eachWhile, 1);
    Type_registerMethodImplementation(type, "equals", Map_equals, 1);
    Type_registerMethodImplementation(type, "exclude", Map_exclude, 1);
    Type_registerMethodImplementation(type, "find", Map_find, 1);
    Type_registerMethodImplementation(type, "findAll", Map_findAll, 1);
    Type_registerMethodImplementation(type, "get", Map_get_1, 1);
    Type_registerMethodImplementation(type, "get", Map_get, 2);
    Type_registerMethodImplementation(type, "getOrAdd", Map_getOrAdd, 2);
    Type_registerMethodImplementation(type, "hash", Map_hash, 0);
    Type_registerMethodImplementation(type, "isEmpty", Map_isEmpty, 0);
    Type_registerMethodImplementation(type, "isRO", Map_isRO, 0);
    Type_registerMethodImplementation(type, "isRW", Map_isRW, 0);
    Type_registerMethodImplementation(type, "join", Map_join_1, 1);
    Type_registerMethodImplementation(type, "join", Map_join, 2);
    Type_registerMethodImplementation(type, "keys", Map_keys, 0);
    Type_registerMethodImplementation(type, "map", Map_map, 1);
    Type_registerMethodImplementation(type, "reduce", Map_reduce, 2);
    Type_registerMethodImplementation(type, "remove", Map_remove, 1);
    Type_registerMethodImplementation(type, "ro", Map_ro, 0);
    Type_registerMethodImplementation(type, "rw", Map_rw, 0);
    Type_registerMethodImplementation(type, "set", Map_set, 2);
    Type_registerMethodImplementation(type, "setAll", Map_setAll, 1);
    Type_registerMethodImplementation(type, "setList", Map_setList_1, 1);
    Type_registerMethodImplementation(type, "setList", Map_setList, 2);
    Type_registerMethodImplementation(type, "size", Map_size, 0);
    Type_registerMethodImplementation(type, "toCode", Map_toCode, 0);
    Type_registerMethodImplementation(type, "toStr", Map_toStr, 0);
    Type_registerMethodImplementation(type, "vals", Map_vals, 0);
    Type_registerFieldImplementation(type, "caseInsensitive", Map_caseInsensitive, Map_setCaseInsensitive);
    Type_registerFieldImplementation(type, "def", Map_def, Map_setDef);
    Type_registerFieldImplementation(type, "ordered", Map_ordered, Map_setOrdered);
    Map_classType = type;
    Map_initStatic();
  }
  return Map_classType;
}


VTable* Map_initVTable(void)
{
  if (Map_classVTable == NULL)
  {
    VTable* vtable = memoryAlloc(sizeof(MapVTable));
    memcpy(vtable, Obj_initVTable(), sizeof(FanObjVTable));
    ((FanObjVTable*)vtable)->equals = Map_equals;
    ((FanObjVTable*)vtable)->hash = Map_hash;
    ((FanObjVTable*)vtable)->toStr = Map_toStr;
    Map_classVTable = vtable;
  }
  return Map_classVTable;
}


void Map_initStatic(void)
{
}
